package com.lyf.boot.listener;

import com.lyf.boot.listener.event.ChinaAreaEvent;
import com.lyf.boot.modules.system.service.IChinaAreaService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @author Luyufan
 * @date 2023/12/6 12:58
 **/
@Component
@RequiredArgsConstructor
public class ChinaAreaListener {

    private final IChinaAreaService chinaAreaService;

    @Async
    @EventListener(ChinaAreaEvent.class)
    public void chinaAreaHandler(ChinaAreaEvent event) {
        chinaAreaService.crawlChinaArea(event);
    }
}
